package test.test6_18;

public class Demo13 {
    public static void main(String[] args) {
        int sum1 = add(1, 2);
        System.out.println("sum1 = " + sum1);
        int sum2 = add(1, 2, 3);
        System.out.println("sum2 = " + sum2);
    }


    //方法重载:方法名相同，参数列表不同，与返回值类型无关
    //重载的分类：
    //1.参数个数不同
    //2.参数类型不同
    //3.顺序不同




    //求两个整数的和
    public static int add(int a, int b) {
        return a + b;
    }

    //求三个整数的和
    public static int add(int a, int b, int c) {
        return a + b + c;
    }

    public static double add(double a,double b) {
        return a + b;
    }

    public static double add(double a, double b,double c) {
        return a + b + c;
    }


}
